<template>
	<div id="app">
		<NavBar v-if="showNav"/> 
		<router-view/>
	</div>
</template>

<script>
	import NavBar from './components/project/NavBar.vue'
	export default {
		components: {
			NavBar
		},
		data() {
			return {
			}
		}, 
		beforeCreate() {
			/**
			 * 刷新页面会丢失vuex数据，采用临时解决方案
			 */
			if(sessionStorage.getItem('eiip-token')) {
				this.$store.dispatch('setLoginUser', JSON.parse(sessionStorage.getItem('loginUser')))
			}
		},
		created() {
			console.warn('App.vue created');
			/**
			* 临时登录方案（测试用）
			* 系统管理员账号： eip-admin
			* 				 $2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2
			* 租户管理员账号： HDbj001  
			*                $2a$10$S8J7S9iPQFujc/1k6c2bb.8rEM1lglGmxIN0bmOdw81T0WQoCTKbi
			* 
			*/
			// this.$http({
			// 	url: '/api/login',
			// 	method: 'POST',
			// 	data: {
			// 		// "password": "$2a$10$S8J7S9iPQFujc/1k6c2bb.8rEM1lglGmxIN0bmOdw81T0WQoCTKbi",
			// 		// "username": "HDbj001"
			// 		"companyId": 1,
			// 		"password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
			// 		"username": "eip-admin"
			// 	}
			// }).then( res => {
			// 	sessionStorage.setItem("loginUser", JSON.stringify(res.data.userInfo))
			// 	sessionStorage.setItem("eiip-token", res.data['eiip-token']);
			// 	sessionStorage.setItem("menus", JSON.stringify(res.data.userInfo.menus))
			// 	this.$store.dispatch('setLoginUser', res.data.userInfo)
			// 	document.cookie = `eiip-token=${res.data['eiip-token']};`
			// })
		},
		methods: {
			reqPassToken() {
				
			}
		},
		computed: {
			showNav() {
				return this.$route.fullPath != '/register';
			}
		}
	}
</script>

<style lang="scss">
	// @import url(//at.alicdn.com/t/font_3433188_t5g2y9ai37.css);
	@import url(./assets/font/iconfont.css);
	@import "./assets/css/common";
	#app {
		height: 100%;
	}
</style>
<style>
	/* 滚动条处理 */
	::-webkit-scrollbar{
		width:5px;
		height:5px;
		background-color:#f8f8f8;
		border-radius:8px;
	}
	::-webkit-scrollbar-button{
		display:none;
	}
	::-webkit-scrollbar-track{
		display:none;
	}
	::-webkit-scrollbar-track-piece{
		background-color:#eee;
	}
	::-webkit-scrollbar-thumb {
		background-color:#ddd;
		border-radius:8px;
	}
	::-webkit-scrollbar-corner{
		display:none;
	}
	::-webkit-resizer{
		display:none;
	}
</style>